import jQuery from "jquery";
import { useEffect, useLayoutEffect, useState } from "react";
//fix antd bug.选择控件在屏幕最侧边时，选择弹窗能自适应位置，否则无法选中
export default function(elementRef){
    
    const [placemnet,setPlacement]=useState("bottomLeft")
    
    useEffect(()=>{

        if(elementRef.current){
            let distance=jQuery(window).width() - jQuery(elementRef.current).offset().left
            if(distance<500 && distance>0){
                setPlacement("bottomRight")
            }
        }
    })

    return placemnet


}